<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
	#hd{
		width: 500px;
		height: 300px;
		background: green;
		margin: 10px auto;
	}
</style>
<script type="text/javascript">
	window.onload = function(){
		var hd = document.getElementById('hd');
		// alert(hd.style.height);
		// 获得实际作用在元素身上的样式
		if(document.all){
			var h = hd.currentStyle.height;
		}else{
			var h = getComputedStyle(hd,null).height;
		}

		alert(h);

	}
</script>
</head>

<body>

<div id="hd"></div>

</body>
</html>
